package net.techwatch.guice.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class TimeSpentLogInterceptor implements MethodInterceptor {

	@Override
	public Object invoke(MethodInvocation invocation) throws Throwable {
		long time = System.currentTimeMillis();
		
		Object obj = invocation.proceed();
		
		time = System.currentTimeMillis() - time;
		System.out.println("Time spent in " + invocation.getMethod().getName() + ": " + time);
		
		return obj;
	}

}
